<!-- 政策内页 -->
<template>
  <div class="policy_main">
    <!-- 头部 -->
    <headNav />
    <div class="policy_list mindWidth">
      <div class="policy_crumbs">
        <p class="changeHanld" @click="$router.push('/enterprise?id=' + companyId)">荣誉</p>
        <span>></span>
        {{ titleText }}
      </div>

      <div class="public-container">
        <div class="title flex space-around">
          <div class="title-lable">序号</div>
          <div class="title-lable">企业名称</div>
        </div>
        <div class="list-content">
          <div class="list-item flex space-around">
            <div class="item">1111</div>
            <div class="item">1111</div>
          </div>
        </div>
      </div>

      <!-- 分页列表 -->
      <div class="page">
        <paging ref="paging_zi" @CurrentPage="accept_CurrentValue" :pageNo="pageNos" />
      </div>
    </div>
    <navigation></navigation>
    <!-- 底部 -->
    <footerNav />
  </div>
</template>

<script>
import paging from "../../components/paging.vue"; //分页
import { commonRequest, postRequest } from "../../api/api.js";

export default {
  components: {
    paging
  },
  data() {
    //这里存放数据
    return {
      isSelect: 0, // 是否选中标题
      titleText: "", // 标题文字内容
      companyId: "", // 企业id
      pageIndex: 1, // 当前的页码
      dataList: [],
      pageNos: 1
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    handleClick(index) {
      this.isSelect = index; // 点击切换类名
      this.getDataList();
    },
    // 接受当前选中页数
    accept_CurrentValue(value) {
      this.pageIndex = value;
      this.getDataList();
      // this.pageNos = value;
    },
    getDataList() {
      let obj = {
        beginDate: "",
        dq: "",
        endDate: "",
        pageIndex: this.pageIndex - 1,
        pageSize: 10,
        policyId: "",
        source: "",
        title: this.titleText,
        tzlb: this.isSelect === 0 ? "通知" : "公示",
        userID: ""
      };
      postRequest("/api/es/Policy/queryPolicyList.json", obj).then(res => {
        if (res.retCode == 0) {
          this.dataList = res.data.content;
          this.$refs.paging_zi.totalValue(res.data.totalElements);
        }
      });
    }
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {
    // 获取地址栏的参数
    let { title, id } = this.$route.query;
    this.titleText = title; // 获取到地址栏标题信息
    this.companyId = id; // 接收公司的企业id
    this.getDataList(); // 获取数据列表
  }
};
</script>
<style lang="less" scoped>
//@import url(); 引入公共css类
.policy_list {
  .policy_crumbs {
    height: 80px;
    display: flex;
    align-items: center;

    span {
      margin: 10px;
    }
  }

  .public-container {
    width: 100%;
  }

  .content_image {
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    image {
      width: 300px;
    }
    p {
      color: rgb(204, 204, 204);
      font-size: 14px;
      margin-top: 10px;
    }
  }

  .page {
    display: flex;
    align-items: center;
    height: 80px;
    justify-content: flex-end;
  }
}
</style>
